package com.springday3aoptransaction.service.impl;

import com.springday3aoptransaction.dao.LogDao;
import com.springday3aoptransaction.service.LogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

@Service
public class LogServiceImpl implements LogService {

    @Autowired
    private LogDao logDao;

    //    propagation设置事务属性-传播行为，REQUIRES_NEW表示当前操作需要新事物
    @Transactional(propagation = Propagation.REQUIRES_NEW)
    @Override
    public void log(String out, String in, Double money) {
        logDao.log("转账操作由" + out + "到" + in + "，金额：" + money);
    }
}
